<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta name = "format-detection" content = "telephone=no">
    <title>自提地址</title>
    <link rel="stylesheet" href="/Public/Home/css/address.css">
    <!--不识别数字为手机-->
<meta name="format-detection" content="telephone=no, email=no"/>
<!--通用js-->
<?php if(isset($signPackage) && !empty($signPackage)){ ?>
<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js?v=201704270010"></script>
<?php } ?>
<script type="text/javascript" src="/Public/Home/js/require.js"></script>
<script type="text/javascript" src="/Public/Home/js/baseLoading.js?v=201705240001"></script>
<script src="/Public/Home/js/jquery.min.js" ></script>
<script src="/Public/Home/js/pincode-input.js" ></script>
<script src="/Public/Home/js/parabola.js" ></script>
<script src="/Public/Home/js/lazyload/jquery.lazyload.min.js"></script>
<script type="text/javascript">
    _global.isLogin = !!"<?php echo $wx_member_id; ?>";
	var isWxShareDiy = typeof yc_share_diy === "undefined" ? false : yc_share_diy;
	var yc_wx_shareImgPath = "";
	<?php if(isset($weixin_logo) && !empty($weixin_logo)){ ?>
		yc_wx_shareImgPath = "/Uploads/<?php echo ($weixin_logo["image"]); ?>";
	<?php } ?>
    var yc_pass_arr = {'local_id':"<?php echo I('local_id',1);?>",'top_local_id':"<?php echo I('top_local_id',1);?>"};
	if(parseInt(yc_pass_arr["local_id"]) == 21){
		_global.isStopSell = true;
	}
    <?php if(isset($signPackage) && !empty($signPackage)){ ?>
        _global.isWeiXinLoad = true;
        var isEnableLocation = typeof yc_wx_location === "undefined" ? false : yc_wx_location;
        var yc_wx_options = {
            "enableLocation" : isEnableLocation,
            "refuseCallback" : function(){},
            "mapCallback" : function(){},
            "config" : {
                debug: false,
                appId: '<?php echo $signPackage["appId"];?>',
                timestamp: '<?php echo $signPackage["timestamp"];?>',
                nonceStr: '<?php echo $signPackage["nonceStr"];?>',
                signature: '<?php echo $signPackage["signature"];?>',
                jsApiList: [
                    'checkJsApi'
                ]
            }
        };
        var isInHeader = typeof yc_wx_useInHeader === "undefined" ? true : yc_wx_useInHeader;
        if(isInHeader){
            wxAutoConfig(yc_wx_options);
        }
    <?php } ?>
</script>
</head>
<body>
<div class="warp">
    <div class="location-box" style="display:block;">
        <div class="user-phone">
            <span>提货人电话:</span>
            <p>
                <input type="text" value="<?php echo ($data["mobile"]); ?>" id="mobile">
            	<h5>该电话用作提取自提时候的凭证。</h5>
            </p>
        </div>
        <div class="location-result pdLR">
            <ul>

            <?php if(is_array($zTList)): $i = 0; $__LIST__ = $zTList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$zt): $mod = ($i % 2 );++$i;?><li data-local="<?php echo ($data["local_id"]); ?>" data-id="<?php echo ($zt["dot_id"]); ?>">
    				<p class="clearfix"><span class="md-name"><?php echo ($zt["store_dot_name"]); ?></span><?php if($zt['dot_id'] == $data['dot_id']): ?><span class="current">当前</span><?php endif; ?></p>
                    <p>提货时间：<span><?php echo ($zt["tihuo_time"]); ?></span></p>
                    <p class="address"><?php echo ($zt["area_text"]); echo ($zt["addr"]); ?></p>
                </li><?php endforeach; endif; else: echo "" ;endif; ?>

            </ul>
        </div>
    </div>
</div>
<script src="/Public/Home/js/validate.js"></script>
<script type="text/javascript">
   require(['base']);
   var _isAjaxClick = false;
   $("div.location-result ul li").click(function(){
	   if(_isAjaxClick) return;
	   _isAjaxClick = true;
       var dotid =$(this).data('id');
       var _mobile = $('#mobile').val();
       var local_id=$(this).data('local');
	   var msg = mbValidator.isMobile(_mobile);
       if(msg != ""){
           _global.promote.alertPopup(msg);
		   _isAjaxClick = false;
           return false;
       }

       $.ajax({
           url:"<?php echo U('Carts/changeLocalDot');?>",
           type:'post',
           datatype:'json',
           data:{'dot_id':dotid, 'mobile': _mobile, 'local_id':local_id,'store_dot_name':$(this).find('.md-name').text()},
           success:function (data) {
              window.location.href="<?php echo url('Home/Carts/cart');?>";
			  _isAjaxClick = false;
           },
           error:function (err) {
			   _global.promote.alertPopup("服务器异常，请稍后重试！"); 
			   _isAjaxClick = false;
           }
       })
    });
</script>
</body>
</html>